<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="edu.hcmus.sow.utils.StringUtil"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<%@page import="java.util.Date"%>

<c:forEach items="${forums}" var="forum" varStatus="i" >
	<ul class="list list_simple discussionlist">
		<li>
			<div class="fixed">
				<div class="f_left">
					
					<c:if test="${latestTopics.get(i.count -1) != null }">
					
						<span class="date">
						 
						 <a href="${pageContext.request.contextPath}/topic/${latestTopics.get(i.count -1).id}/view">lastest topic </a> 
						 
						 &nbsp; 
						<c:set var="createdDate" value="${latestTopics.get(i.count -1).createdDate.getTime()}"></c:set>
						<span><%=new PrettyTime().format((Date) pageContext.getAttribute("createdDate"))%></span>
						 by <span>${latestTopics.get(i.count -1).user.username }</span>
								
						</span> 
					</c:if>
		
					<c:if test="${latestTopics.get(i.count -1) == null }">
						<span class="date">&nbsp;</span>
					</c:if>
					<span class="date"> <span>${topicsNumber.get(i.count - 1) }</span><a href="${pageContext.request.contextPath}/box/${forum.id}/view">&nbsp;topics</a>

					</span>
				</div>
				<span> <a class="profileThumb" href=""> <span
						class="thumbmask"> <span class="topleft"></span> <span
							class="topright"></span> <span class="bottomleft"></span> <span
							class="bottomright"></span>
					</span>
				</a>
				</span>
			</div>
			<div class="fluid">
				<img class="icon" id="type2a0"
					src="${pageContext.request.contextPath}/images/forum_icon.jpg">
				<div class="discussiontitle">
					<a href="${pageContext.request.contextPath}/box/${forum.id}/view"><span>${forum.name }</span></a> <br> 
					<c:set var="content" value="${forum.description }"></c:set> 
					<span>
						<%=StringUtil.removeHTML(StringUtil.subStringToDisplay((String)(pageContext.getAttribute("content")).toString(), 100)) %>
					</span>
					
				</div>
			</div>
		</li>
	</ul>
	<div class="spacer"></div>
</c:forEach>